<?php
class Q_Rule_Length extends Q_Rule_Abstract {

    /**
     * The parameters that were passed to this rule
     */
    protected $_params = array(
        'field' => 0, // default is zero because this allows $rule->validate('some text')
        'min' => 0,
        'max' => null,
    );
    /**
     * 
     */
    public function isValid($value) {
    
        $length = strlen($value);
        if ($length >= $this->getParam('min')) {
            if ($this->getParam('max') == null) return true;
            else return !($length > $this->getParam('max'));
        }
        return false;
    
    }

}